package com.magicalcoder.youyamvc.app.goodsimg.dao.impl;

import com.magicalcoder.youyamvc.app.model.defined.IntegerDate;
import com.magicalcoder.youyamvc.app.model.defined.IntegerObject;
import com.magicalcoder.youyamvc.app.goodsimg.dao.GoodsImgDao;
import com.magicalcoder.youyamvc.app.model.GoodsImg;
import com.magicalcoder.youyamvc.app.model.defined.GoodsImgWithGoods;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* 代码为自动生成 Created by www.magicalcoder.com
* 如果你改变了此类 read 请将此行删除
* 欢迎加入官方QQ群:323237052
*/

@Component("goodsImgDao")
public class GoodsImgDaoImpl   implements GoodsImgDao {

    @Resource(name="sqlSessionTemplate")
    private  SqlSessionTemplate  sqlSessionTemplate;
    @Override
    public GoodsImg getGoodsImg(Map<String, Object> query) {
        return sqlSessionTemplate.selectOne("GoodsImgMapper.getGoodsImg",query);
    }
    @Override
    public List<GoodsImg> getGoodsImgList(Map<String, Object> query) {
        return sqlSessionTemplate.selectList("GoodsImgMapper.getGoodsImgList", query);
    }
    @Override
    public Integer getGoodsImgListCount(Map<String, Object> query) {
        return sqlSessionTemplate.selectOne("GoodsImgMapper.getGoodsImgListCount", query);
    }

    @Override
    public void batchInsertGoodsImg(List<GoodsImg> list) {
        sqlSessionTemplate.insert("GoodsImgMapper.batchInsertGoodsImg",list);
    }

    @Override
    public void batchReplaceGoodsImg(List<GoodsImg> list) {
        sqlSessionTemplate.insert("GoodsImgMapper.batchReplaceGoodsImg",list);
    }

    @Override
    public void batchUpdateGoodsImg(List<GoodsImg> list) {
        sqlSessionTemplate.update("GoodsImgMapper.batchUpdateGoodsImg",list);
    }

    @Override
    public     Long  insertGoodsImg(GoodsImg entity) {
        sqlSessionTemplate.insert("GoodsImgMapper.insertGoodsImg",entity);
  return entity.getId();    }

    @Override
    public     Long  replaceGoodsImg(GoodsImg entity) {
        sqlSessionTemplate.insert("GoodsImgMapper.replaceGoodsImg",entity);
  return entity.getId();    }

    @Override
    public void updateGoodsImg(GoodsImg entity) {
        sqlSessionTemplate.update("GoodsImgMapper.updateGoodsImg", entity);
    }
    @Override
    public void updateGoodsImgWithoutNull(GoodsImg entity) {
        sqlSessionTemplate.update("GoodsImgMapper.updateGoodsImgWithoutNull", entity);
    }
    @Override
    public void updateGoodsImgByWhereSql(Map<String,Object> entity) {
        sqlSessionTemplate.update("GoodsImgMapper.updateGoodsImgByWhereSql", entity);
    }
    @Override
    public List<GoodsImgWithGoods> getGoodsImgWithGoodsByGoodsIdList(Map<String, Object> query){
        return sqlSessionTemplate.selectList("GoodsImgMapper.getGoodsImgWithGoodsByGoodsIdList", query);
    }
    @Override
    public void truncateGoodsImg() {
        sqlSessionTemplate.delete("GoodsImgMapper.truncateGoodsImg");
    }
    @Override
    public void deleteGoodsImg(Map<String, Object> query) {
        sqlSessionTemplate.delete("GoodsImgMapper.deleteGoodsImg",query);
    }
    @Override
    public void deleteGoodsImgList(Map<String, Object> query) {
        sqlSessionTemplate.delete("GoodsImgMapper.deleteGoodsImgList",query);
    }
    @Override
    public void deleteGoodsImgByWhereSql(Map<String, Object> query) {
        sqlSessionTemplate.delete("GoodsImgMapper.deleteGoodsImgByWhereSql",query);
    }
    @Override
    public void batchDeleteGoodsImg(List<Long> list) {
        sqlSessionTemplate.delete("GoodsImgMapper.batchDeleteGoodsImg",list);
    }
    @Override
    public void batchDeleteGoodsImgList(List<GoodsImg> list) {
        sqlSessionTemplate.delete("GoodsImgMapper.batchDeleteGoodsImgList",list);
    }

    @Override
    public List<IntegerDate> statisticsDateCountList(Map<String, Object> query) {
    return sqlSessionTemplate.selectList("GoodsImgMapper.statisticsDateCountList", query);
    }

    @Override
    public List<IntegerDate> statisticsDateIntervalList(Map<String, Object> query) {
        return sqlSessionTemplate.selectList("GoodsImgMapper.statisticsDateIntervalList", query);
    }

    @Override
    public List<IntegerObject> statisticsGroupList(Map<String, Object> query) {
        return sqlSessionTemplate.selectList("GoodsImgMapper.statisticsGroupList", query);
    }
}
